{% load static from staticfiles %}
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>目录扫描</title>
    <link rel="stylesheet" href="{% static "layui/css/layui.css" %}" media="all">
<style>


</style>
</head>

<body>
    <div class="layui-tab layui-tab-card" style="margin-top:0px;">
        <ul class="layui-tab-title">
            <li class="layui-this"><i class="layui-icon">&#xe68e;</i><span></span>目录扫描</li>
        </ul>
    </div>

    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>目录扫描</legend>
    </fieldset>


    <form class="layui-form" action="/tools/dirReady" method="post">
        <div class="layui-form-item">
            <label class="layui-form-label">域名</label>
            <div class="layui-input-block">
                <input type="text" name="domain" lay-verify="required" autocomplete="off" placeholder="请输入域名或IP" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">线程数</label>
            <div class="layui-input-block">
                <input type="text" name="threadSize" lay-verify="required" placeholder="请输入线程数" autocomplete="off" class="layui-input" value="20">
            </div>
        </div>
        <!-- <div class="layui-form-item">
                <label class="layui-form-label">是否递归</label>
                <div class="layui-input-block">
                  <input type="checkbox" name="isRecursion" lay-skin="switch" lay-text="ON|OFF" value="1">
                </div>
              </div> -->
        <div class="layui-form-item">
            <label class="layui-form-label">设置关键字</label>
            <div class="layui-input-inline">
                <select name="isKeywords" lay-verify="required" lay-filter="kwFlag">
                  <option value="1">是</option>
                  <option value="2" selected="selected">否</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item" id="kwText"></div>

        <div class="layui-form-item">
            <label class="layui-form-label">扫描类型</label>
            <div class="layui-input-block">
                <input type="checkbox" name="dicts" value="default" title="default" checked="checked">
                <input type="checkbox" name="dicts" value="php" title="php">
                <input type="checkbox" name="dicts" value="asp" title="asp">
                <input type="checkbox" name="dicts" value="aspx" title="aspx">
                <input type="checkbox" name="dicts" value="jsp" title="jsp">
                <input type="checkbox" name="dicts" value="dir" title="DIR">
                <input type="checkbox" name="dicts" value="pack" title="PACK">
            </div>
        </div>   

        <div class="layui-form-item">
                <label class="layui-form-label">探测状态码</label>
                <div class="layui-input-block">
                    <input type="checkbox" name="url_status" value="200" title="200" checked="checked">
                    <input type="checkbox" name="url_status" value="403" title="403" checked="checked">
                    <input type="checkbox" name="url_status" value="302" title="302">
                </div>
            </div>   

      <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn" lay-submit lay-filter="sub">开始扫描</button>
        </div>
      </div>
    </form> 


         



<script src="{% static "layui/layui.js" %}"></script>
<script>
    layui.use(['jquery','element','layer','form'], function() {
        var $ = layui.jquery,
        form=layui.form;


        form.on('select(kwFlag)', function(data){
            var html =""
            var html2 ="<label class='layui-form-label'>关键字</label>"+
                        "<div class='layui-input-block'>"+
                            "<textarea placeholder='请输入关键字' name='keywords' class='layui-textarea'>flag,ctf</textarea>"+
                        "</div>";
            if(data.value==2){
                $("#kwText").html(html);
            }else{
                $("#kwText").html(html2);
            }
        });


        $(".layui-btn-primary").click(function(){
                $("#portval").html("");
                var iphtml='<div class="layui-form-item">'+
                            '<label class="layui-form-label">IP</label>'+
                            '<div class="layui-input-block">'+
                            '<input type="text" name="ips" lay-verify="required" autocomplete="off" placeholder="请输入IP" class="layui-input">'+
                            '</div>'+
                            '</div>';
                $("#ipval").html(iphtml);                
            });


            form.on('submit(sub)', function(data){
                console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
            });
    
    });
</script>       

</body>

</html>